package com.zbkj.crmeb.task.order;

import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import com.crmeb.core.utils.RedisUtil;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.zbkj.crmeb.bill.service.MerFreezeBillService;
import com.zbkj.crmeb.front.service.OrderService;
import com.zbkj.crmeb.merchant.admin.service.StoreProductStockService;
import com.zbkj.crmeb.store.service.*;
import com.zbkj.crmeb.store.utilService.OrderUtils;

@Component
@Configuration //读取配置
@Slf4j
public class GroupActivityTask {
    //日志
    private static final Logger logger = LoggerFactory.getLogger(GroupActivityTask.class);

    @Autowired
    private UserCommissionService userCommissionService;

    @Autowired
    private StoreProductStockService storeProductStockService;

    //30分钟同步一次数据
    @XxlJob("completeCommission")
    public void completeCommission(){
        try {
            // 解冻佣金
            userCommissionService.completeCommissionForGroupActivity();
            // 归还拼团锁定的库存量
//            storeProductStockService.returnStockForActivityFinish();
        }catch (Exception e){
            e.printStackTrace();
            logger.error("OrderTakeByUser.task" + " | msg : " + e.getMessage());
        }
    }

}
